Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #81674

Closed
wants to merge 28 commits into from
Closed

Conversation

m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented Feb 2, 2021

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Amanieu d'Antras and others added 28 commits January 27, 2021 22:47
On big-endian the values need to be right-aligned within a 64-bit register, as if the value had been read with a 64-bit load instruction.
This extends the `panic_fmt` lint to warn for all cases where the first
argument cannot be interpreted as a format string, as will happen in
Rust 2021.

It suggests to add `"{}", ` to format the message as a string. In the
case of `std::panic!()`, it also suggests the recently stabilized
`std::panic::panic_any()` function as an alternative.

It renames the lint to `non_fmt_panic` to match the lint naming
guidelines.
Scalars can represent integers up to u128, but the docs state otherwise.
Previously, it's not clear what exactly should be added in the suggested where clause,
so this adds an example to demonstrate.
Editorconfig is a lightweight specification that
helps maintaining consistent coding/formatting style
accross editors, especially those editors
that are not explicitly aware of Rust and rustfmt.

https://editorconfig.org/
Upgrade Chalk

~~Blocked on rust-lang/chalk#670~~
~~Now blocked on rust-lang/chalk#680 and release~~

In addition to the straight upgrade, I also tried to fix some tests by properly returning variables and max universes in the solution. Unfortunately, this actually triggers the same perf problem that rustc traits code runs into in `canonicalizer`. Not sure what the root cause of this problem is, or why it's supposed to be solved in chalk.

r? `@nikomatsakis`
…Simulacrum

Add .editorconfig

This adds a .editorconfig file to rust-lang/rust, matching Clippy's. It's not clear that this will benefit many people, but the cost is low and the rewards are potentially meaningful.
Add AArch64 big-endian and ILP32 targets

This PR adds 3 new AArch64 targets:
- `aarch64_be-unknown-linux-gnu`
- `aarch64-unknown-linux-gnu_ilp32`
- `aarch64_be-unknown-linux-gnu_ilp32`

It also fixes some ABI issues on big-endian ARM and AArch64.
Add better diagnostic for unbounded Abst. Const

~~In the case where a generic abst. const requires a trivial where bound: `where TypeWithConst<const_fn(N)>: ,`,
instead of requiring a where bound, just check that only consts are being substituted in to skip over where check.~~

~~This is pretty sketchy, but I think it works. Presumably, if there is checking for type bounds added later, it can first check nested requirements, and see if they're satisfied by the current `ParamEnv`.~~

Changed the diagnostic to add a better example, which is more practical than what was previously proposed.

r? `@lcnr`
Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T>>` later on

`@rustbot` modify labels +C-cleanup +T-compiler
Add lint for `panic!(123)` which is not accepted in Rust 2021.

This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021.

It suggests to add `"{}",` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized
`std::panic::panic_any()` function as an alternative.

It renames the lint to `non_fmt_panic` to match the lint naming guidelines.

![image](https://user-images.githubusercontent.com/783247/106520928-675ea680-64d5-11eb-81f7-d8fa48b93a0b.png)

This is part of rust-lang#80162.

r? `@estebank`
…ewording, r=estebank

Improve wording of suggestion about accessing field

Follow-up to rust-lang#81504

The compiler at this moment suggests "you might have meant to use field `b` of type `B`", sounding like it's type `B` which has the field `b`.
r? `@estebank`
Fix out of date `Scalar` documentation

Scalars can represent integers up to `u128`, but the docs state otherwise.
@rustbot rustbot added the rollup A PR which is a rollup label Feb 2, 2021
@m-ou-se
Copy link
Member Author

m-ou-se commented Feb 2, 2021

@bors r+ p=8 rollup=never

@bors
Copy link
Contributor

bors commented Feb 2, 2021

📌 Commit ddf8dc7 has been approved by m-ou-se

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 2, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  EXTRA_VARIABLES: {
 "CI_ONLY_WHEN_SUBMODULES_CHANGED": 1
##[endgroup]
adding extra environment variable CI_ONLY_WHEN_SUBMODULES_CHANGED
linux builder detected, using docker to run the build
##[group]Run src/ci/scripts/should-skip-this.sh
---
   Compiling miri v0.1.0 (/checkout/src/tools/miri)
warning: panic message is not a string literal
   --> /checkout/library/alloc/src/macros.rs:111:23
    |
110 |  / macro_rules! format {
111 |  |     ($($arg:tt)*) => {{
    |  |_______________________^
112 | ||         let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
113 | ||         res
114 | ||     }}
    | ||_____^
115 |  | }
    |  |_- in this expansion of `format!`
   ::: src/tools/miri/src/bin/miri.rs:233:32
    |
233 |                            panic!(format!(
    |  _________________________________-
    |  _________________________________-
234 | |                              "-Zmiri-seed must be at most 8 bytes, was {}",
235 | |                              seed_raw.len()
236 | |                          ));
    | |__________________________- in this macro invocation
    |
    = note: `#[warn(non_fmt_panic)]` on by default
    = note: this is no longer accepted in Rust 2021
warning: 1 warning emitted

    Finished release [optimized] target(s) in 1m 36s
Building stage2 tool cargo-miri (x86_64-unknown-linux-gnu)
---
   Compiling tester v0.7.0
warning: panic message is not a string literal
   --> /checkout/library/alloc/src/macros.rs:111:23
    |
110 |  / macro_rules! format {
111 |  |     ($($arg:tt)*) => {{
    |  |_______________________^
112 | ||         let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
113 | ||         res
114 | ||     }}
    | ||_____^
115 |  | }
    |  |_- in this expansion of `format!`
   ::: src/tools/miri/src/bin/miri.rs:233:32
    |
233 |                            panic!(format!(
    |  _________________________________-
    |  _________________________________-
234 | |                              "-Zmiri-seed must be at most 8 bytes, was {}",
235 | |                              seed_raw.len()
236 | |                          ));
    | |__________________________- in this macro invocation
    |
    = note: `#[warn(non_fmt_panic)]` on by default
    = note: this is no longer accepted in Rust 2021
warning: 1 warning emitted

    Finished release [optimized] target(s) in 1m 13s
     Running build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/miri-5aa992efebf876f1
---
normalized stderr:
warning: panic message is not a string literal
  --> $DIR/catch_panic.rs:LL:38
   |
54 |     test(None, |old_val| std::panic!(format!("Hello from panic: {:?}", old_val)));
   |
   |
   = note: `#[warn(non_fmt_panic)]` on by default
   = note: this is no longer accepted in Rust 2021

warning: panic message is not a string literal
  --> $DIR/catch_panic.rs:LL:39
   |
   |
56 |     test(None, |_old_val| std::panic!(1337));
   |
   = note: this is no longer accepted in Rust 2021
   = note: this is no longer accepted in Rust 2021
help: add a "{}" format string to Display the message
   |
56 |     test(None, |_old_val| std::panic!("{}", 1337));
   |                                       ^^^^^
help: or use std::panic::panic_any instead
   |
56 |     test(None, |_old_val| std::panic::panic_any(1337));

warning: panic message is not a string literal
  --> $DIR/catch_panic.rs:LL:39
   |
   |
60 |     test(None, |old_val| core::panic!(&format!("Hello from panic: {:?}", old_val)));
   |
   = note: this is no longer accepted in Rust 2021
   = note: this is no longer accepted in Rust 2021
help: add a "{}" format string to Display the message
   |
60 |     test(None, |old_val| core::panic!("{}", &format!("Hello from panic: {:?}", old_val)));

thread 'main' panicked at 'Hello from panic: std', $DIR/catch_panic.rs:LL:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Caught panic message (&str): Hello from panic: std
---

+warning: panic message is not a string literal
+  --> $DIR/catch_panic.rs:LL:38
+   |
+54 |     test(None, |old_val| std::panic!(format!("Hello from panic: {:?}", old_val)));
+   |
+   |
+   = note: `#[warn(non_fmt_panic)]` on by default
+   = note: this is no longer accepted in Rust 2021
+
+warning: panic message is not a string literal
+  --> $DIR/catch_panic.rs:LL:39
+   |
+   |
+56 |     test(None, |_old_val| std::panic!(1337));
+   |
+   = note: this is no longer accepted in Rust 2021
+   = note: this is no longer accepted in Rust 2021
+help: add a "{}" format string to Display the message
+   |
+56 |     test(None, |_old_val| std::panic!("{}", 1337));
+   |                                       ^^^^^
+help: or use std::panic::panic_any instead
+   |
+56 |     test(None, |_old_val| std::panic::panic_any(1337));
+
+warning: panic message is not a string literal
+  --> $DIR/catch_panic.rs:LL:39
+   |
+   |
+60 |     test(None, |old_val| core::panic!(&format!("Hello from panic: {:?}", old_val)));
+   |
+   = note: this is no longer accepted in Rust 2021
+   = note: this is no longer accepted in Rust 2021
+help: add a "{}" format string to Display the message
+   |
+60 |     test(None, |old_val| core::panic!("{}", &format!("Hello from panic: {:?}", old_val)));
+
 thread 'main' panicked at 'Hello from panic: std', $DIR/catch_panic.rs:LL:27
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 Caught panic message (&str): Hello from panic: std
---
 Success!
 

The actual stderr differed from the expected stderr.
Actual stderr saved to /tmp/compiletestwKMAzX/panic/catch_panic.stderr
To update references, run this command from build directory:
tests/run-pass/update-references.sh '/tmp/compiletestwKMAzX' 'panic/catch_panic.rs'
error: 1 errors occurred comparing output.
status: exit code: 0
status: exit code: 0
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools-bin/miri" "tests/run-pass/panic/catch_panic.rs" "-L" "/tmp/compiletestwKMAzX" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/tmp/compiletestwKMAzX/panic/catch_panic.stage-id" "-A" "unused" "--edition" "2018" "-Astable-features" "--sysroot" "/home/user/.cache/miri/HOST" "-Zmiri-symbolic-alignment-check" "-L" "/tmp/compiletestwKMAzX/panic/catch_panic.stage-id.aux"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
{"message":"panic message is not a string literal","code":{"code":"non_fmt_panic","explanation":null},"level":"warning","spans":[{"file_name":"/checkout/library/alloc/src/macros.rs","byte_start":3730,"byte_end":3830,"line_start":111,"line_end":114,"column_start":23,"column_end":6,"is_primary":true,"text":[{"text":"    ($($arg:tt)*) => {{","highlight_start":23,"highlight_end":24},{"text":"        let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));","highlight_start":1,"highlight_end":81},{"text":"        res","highlight_start":1,"highlight_end":12},{"text":"    }}","highlight_start":1,"highlight_end":6}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":{"span":{"file_name":"tests/run-pass/panic/catch_panic.rs","byte_start":1678,"byte_end":1720,"line_start":54,"line_end":54,"column_start":38,"column_end":80,"is_primary":false,"text":[{"text":"    test(None, |old_val| std::panic!(format!(\"Hello from panic: {:?}\", old_val)));","highlight_start":38,"highlight_end":80}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},"macro_decl_name":"format!","def_site_span":{"file_name":"/checkout/library/alloc/src/macros.rs","byte_start":3686,"byte_end":3833,"line_start":110,"line_end":115,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"macro_rules! format {","highlight_start":1,"highlight_end":1},{"text":"    ($($arg:tt)*) => {{","highlight_start":1,"highlight_end":1},{"text":"        let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));","highlight_start":1,"highlight_end":1},{"text":"        res","highlight_start":1,"highlight_end":1},{"text":"    }}","highlight_start":1,"highlight_end":1},{"text":"}","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}}}],"children":[{"message":"`#[warn(non_fmt_panic)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"this is no longer accepted in Rust 2021","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"warning: panic message is not a string literal\n  --> tests/run-pass/panic/catch_panic.rs:54:38\n   |\n54 |     test(None, |old_val| std::panic!(format!(\"Hello from panic: {:?}\", old_val)));\n   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = note: `#[warn(non_fmt_panic)]` on by default\n   = note: this is no longer accepted in Rust 2021\n   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)\n\n"}
{"message":"panic message is not a string literal","code":{"code":"non_fmt_panic","explanation":null},"level":"warning","spans":[{"file_name":"tests/run-pass/panic/catch_panic.rs","byte_start":1836,"byte_end":1840,"line_start":56,"line_end":56,"column_start":39,"column_end":43,"is_primary":true,"text":[{"text":"    test(None, |_old_val| std::panic!(1337));","highlight_start":39,"highlight_end":43}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"this is no longer accepted in Rust 2021","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"add a \"{}\" format string to Display the message","code":null,"level":"help","spans":[{"file_name":"tests/run-pass/panic/catch_panic.rs","byte_start":1836,"byte_end":1836,"line_start":56,"line_end":56,"column_start":39,"column_end":39,"is_primary":true,"text":[{"text":"    test(None, |_old_val| std::panic!(1337));","highlight_start":39,"highlight_end":39}],"label":null,"suggested_replacement":"\"{}\", ","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null},{"message":"or use std::panic::panic_any instead","code":null,"level":"help","spans":[{"file_name":"tests/run-pass/panic/catch_panic.rs","byte_start":1824,"byte_end":1836,"line_start":56,"line_end":56,"column_start":27,"column_end":39,"is_primary":true,"text":[{"text":"    test(None, |_old_val| std::panic!(1337));","highlight_start":27,"highlight_end":39}],"label":null,"suggested_replacement":"std::panic::panic_any(","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"warning: panic message is not a string literal\n  --> tests/run-pass/panic/catch_panic.rs:56:39\n   |\n56 |     test(None, |_old_val| std::panic!(1337));\n   |                                       ^^^^\n   |\n   = note: this is no longer accepted in Rust 2021\nhelp: add a \"{}\" format string to Display the message\n   |\n56 |     test(None, |_old_val| std::panic!(\"{}\", 1337));\n   |                                       ^^^^^\nhelp: or use std::panic::panic_any instead\n   |\n56 |     test(None, |_old_val| std::panic::panic_any(1337));\n   |                           ^^^^^^^^^^^^^^^^^^^^^^\n\n"}
{"message":"panic message is not a string literal","code":{"code":"non_fmt_panic","explanation":null},"level":"warning","spans":[{"file_name":"tests/run-pass/panic/catch_panic.rs","byte_start":1969,"byte_end":2012,"line_start":60,"line_end":60,"column_start":39,"column_end":82,"is_primary":true,"text":[{"text":"    test(None, |old_val| core::panic!(&format!(\"Hello from panic: {:?}\", old_val)));","highlight_start":39,"highlight_end":82}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"this is no longer accepted in Rust 2021","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"add a \"{}\" format string to Display the message","code":null,"level":"help","spans":[{"file_name":"tests/run-pass/panic/catch_panic.rs","byte_start":1969,"byte_end":1969,"line_start":60,"line_end":60,"column_start":39,"column_end":39,"is_primary":true,"text":[{"text":"    test(None, |old_val| core::panic!(&format!(\"Hello from panic: {:?}\", old_val)));","highlight_start":39,"highlight_end":39}],"label":null,"suggested_replacement":"\"{}\", ","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"warning: panic message is not a string literal\n  --> tests/run-pass/panic/catch_panic.rs:60:39\n   |\n60 |     test(None, |old_val| core::panic!(&format!(\"Hello from panic: {:?}\", old_val)));\n   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = note: this is no longer accepted in Rust 2021\nhelp: add a \"{}\" format string to Display the message\n   |\n60 |     test(None, |old_val| core::panic!(\"{}\", &format!(\"Hello from panic: {:?}\", old_val)));\n   |                                       ^^^^^\n\n"}
thread 'main' panicked at 'Hello from panic: std', tests/run-pass/panic/catch_panic.rs:53:27
Caught panic message (&str): Hello from panic: std
thread 'main' panicked at 'Hello from panic: 1', tests/run-pass/panic/catch_panic.rs:54:26
Caught panic message (String): Hello from panic: 1
thread 'main' panicked at 'Hello from panic: 2', tests/run-pass/panic/catch_panic.rs:55:26
---
    |
110 | / macro_rules! format {
111 |       ($($arg:tt)*) => {{
    |  _______________________^
112 |           let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
114 | |     }}
    | |_____^
115 | | }
    | |_- in this expansion of `format!`
    | |_- in this expansion of `format!`
    | 
   ::: src/tools/clippy/tests/missing-test-files.rs:12:13
    |
12  | /             format!(
13  | |                 "Didn't see a test file for the following files:\n\n{}\n",
15  | |                     .iter()
...   |
...   |
18  | |                     .join("\n")
    | |_____________- in this macro invocation
    |
    |
    = note: `-D non-fmt-panic` implied by `-D warnings`
    = note: this is no longer accepted in Rust 2021
error: aborting due to previous error

error: could not compile `clippy`

@m-ou-se
Copy link
Member Author

m-ou-se commented Feb 2, 2021

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 2, 2021
@m-ou-se
Copy link
Member Author

m-ou-se commented Feb 2, 2021

How did #81645 pass its checks if this fails here? 🤔

@m-ou-se
Copy link
Member Author

m-ou-se commented Feb 2, 2021

adding extra environment variable CI_ONLY_WHEN_SUBMODULES_CHANGED

Ah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.